package com.example.interviewer.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.interviewer.domain.DigitalInterviewers;
import com.example.interviewer.mapper.DigitalInterviewersMapper;
import com.example.interviewer.service.IDigitalInterviewersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.data.redis.core.RedisTemplate;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.CollectionType;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.concurrent.TimeUnit;

/**
 * 数字人面试官配置Service业务层处理
 *
 * @author ruoyi
 * @date 2025-04-06
 */
@Service
public class DigitalInterviewersServiceImpl implements IDigitalInterviewersService
{
    @Autowired
    private DigitalInterviewersMapper digitalInterviewersMapper;
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;
    @Autowired
    private ObjectMapper objectMapper;

    /**
     * 查询数字人面试官配置
     *
     * @param id 数字人面试官配置主键
     * @return 数字人面试官配置
     */
    @Override
    public DigitalInterviewers selectDigitalInterviewersById(Long id)
    {
        return digitalInterviewersMapper.selectDigitalInterviewersById(id);
    }

    /**
     * 查询数字人面试官配置列表
     *
     * @param digitalInterviewers 数字人面试官配置
     * @return 数字人面试官配置分页列表
     */
    @Override
    public Page<DigitalInterviewers> selectDigitalInterviewersList(DigitalInterviewers digitalInterviewers, int pageNum, int pageSize)
    {
        // 创建分页对象
        Page<DigitalInterviewers> page = new Page<>(pageNum, pageSize);
        
        // 直接使用 MyBatis-Plus 的分页查询
        return digitalInterviewersMapper.selectDigitalInterviewersPage(page, digitalInterviewers);
    }

    /**
     * 新增数字人面试官配置
     *
     * @param digitalInterviewers 数字人面试官配置
     * @return 结果
     */
    @Override
    public int insertDigitalInterviewers(DigitalInterviewers digitalInterviewers)
    {
        return digitalInterviewersMapper.insertDigitalInterviewers(digitalInterviewers);
    }

    /**
     * 修改数字人面试官配置
     *
     * @param digitalInterviewers 数字人面试官配置
     * @return 结果
     */
    @Override
    public int updateDigitalInterviewers(DigitalInterviewers digitalInterviewers)
    {
        return digitalInterviewersMapper.updateDigitalInterviewers(digitalInterviewers);
    }

    /**
     * 批量删除数字人面试官配置
     *
     * @param ids 需要删除的数字人面试官配置主键
     * @return 结果
     */
    @Override
    public int deleteDigitalInterviewersByIds(Long[] ids)
    {
        return digitalInterviewersMapper.deleteDigitalInterviewersByIds(ids);
    }

    /**
     * 删除数字人面试官配置信息
     *
     * @param id 数字人面试官配置主键
     * @return 结果
     */
    @Override
    public int deleteDigitalInterviewersById(Long id)
    {
        return digitalInterviewersMapper.deleteDigitalInterviewersById(id);
    }
}
